/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package MODEL;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ahmed
 */
@Entity
@Table(name = "CARACTERISTIQUE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Caracteristique.findAll", query = "SELECT c FROM Caracteristique c"),
    @NamedQuery(name = "Caracteristique.findByIdCar", query = "SELECT c FROM Caracteristique c WHERE c.idCar = :idCar"),
    @NamedQuery(name = "Caracteristique.findByNomCar", query = "SELECT c FROM Caracteristique c WHERE c.nomCar = :nomCar"),
    @NamedQuery(name = "Caracteristique.findByDescriptionCar", query = "SELECT c FROM Caracteristique c WHERE c.descriptionCar = :descriptionCar")})
public class Caracteristique implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @Column(name = "ID_CAR")
    @GeneratedValue(strategy= GenerationType.AUTO)
    private BigDecimal idCar;
    @Basic(optional = false)
    @Column(name = "NOM_CAR")
    private String nomCar;
    @Basic(optional = false)
    @Column(name = "DESCRIPTION_CAR")
    private String descriptionCar;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "caracteristique")
    private Collection<Caracteriser> caracteriserCollection;

    public Caracteristique() {
    }

    public Caracteristique(BigDecimal idCar) {
        this.idCar = idCar;
    }

    public Caracteristique(BigDecimal idCar, String nomCar, String descriptionCar) {
        this.idCar = idCar;
        this.nomCar = nomCar;
        this.descriptionCar = descriptionCar;
    }

    public BigDecimal getIdCar() {
        return idCar;
    }

    public void setIdCar(BigDecimal idCar) {
        this.idCar = idCar;
    }

    public String getNomCar() {
        return nomCar;
    }

    public void setNomCar(String nomCar) {
        this.nomCar = nomCar;
    }

    public String getDescriptionCar() {
        return descriptionCar;
    }

    public void setDescriptionCar(String descriptionCar) {
        this.descriptionCar = descriptionCar;
    }

    @XmlTransient
    public Collection<Caracteriser> getCaracteriserCollection() {
        return caracteriserCollection;
    }

    public void setCaracteriserCollection(Collection<Caracteriser> caracteriserCollection) {
        this.caracteriserCollection = caracteriserCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCar != null ? idCar.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Caracteristique)) {
            return false;
        }
        Caracteristique other = (Caracteristique) object;
        if ((this.idCar == null && other.idCar != null) || (this.idCar != null && !this.idCar.equals(other.idCar))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "MODEL.Caracteristique[ idCar=" + idCar + " ]";
    }
    
}
